<template>
  <div class="message-box" :class="role === 'assistant' ? 'left-box' : 'right-box'">
    <div class="message" :class="role === 'assistant' ? 'left-item' : 'right-item'">{{ content }}</div>
  </div>
</template>

<script>
export default {
  name: "Message",
  props: {
    content: {
      type: String,
      default: "",
    },
    role: {
      type: String,
      default: "user",
    },
  },
  data() {
    return {};
  },
  methods: {},
  components: {},
};
</script>

<style lang="less" scoped>
.message-box {
  width: 100%;

  .message {
    max-width: 240px;
    border-radius: 4px;
    padding: 8px;
    width: fit-content;
  }
}

.right-box {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
}

.left-box {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
}

.right-item {
  background-color: #87ff5899;
}

.left-item {
  background-color: #ffffff;
}
</style>
